Anfy 3d Studio Max plugin

User's notes

by Alessio Feltri & Josui Katayama & Andrea Fasce

 

 

Addendum to 1.2 version

Something is changed inside the plugin: now you cannot any more save a .log file with the plugin (the log option has been disabled), but now you can directly export a scene with all the textures without the need of copying them (you just have to set the flag into the plugin dialog), so you don't have to use the collector any more.

Introduction

This notes is designed to illustrate the anfy3d.txt which is the essential source of the information available for Anfy 3D. The document will cover the handling of objects and materials, lighting, camera work, and animation in Anfy3D. Before getting into the detail, I will first point out the similalities and the differences between Anfy3D and 3D Stduio Max.

3D Studio Max is one of the most used 3D modelling software in professional 3D work place. As demands of 3D animation and its integration to the current web technology is significantly increasing, more and more professional and non-professional users pay their attention to the current VRML and upcoming Java3D technology. Yes, you have already got a solution. VRML from SGI and VRML Consortium provide you a reasonable realtime 3D rendering technology with rich interactive programming capability today. All you require is a bunch of VRML programming knowledge and 3D skills, and ask your site visitors to be equipped with a VRML player, such as Cosmo Player from SGI. Well, this is why VRML hasn't been so popular, despite it's been around for years by now. It's a technology for the elite. It's not too friendly either to users and web developers. Now, you have another choice from us.

Anfy 3D, a creation of a Java genius, provides a reasonable interface between 3D Java rendering engine and 3D Studio Max, and with some careful modeling, you can export virtually any 3D animation scene or sequence from the local Max to the web. No Java programming knowledge is required. All you have to do is: (1) create a scene for Anfy 3D renderer, (2) export the scene to a desired folder, (3) copy all textures and maps to the same folder, and (4) finally edit a HTML document for the detailed setting of the scene. Just as easy as that! You only need a Java-capable browser to display the scene. So, you see what a remarkable achievement we made.

OK, but don't be too excited. There are known limitations. Well, every new technology has certain limitations, so don't be too disappointed, either. You will understand why we intentionally put some limitations to our new technology. To achieve realistic rendering for the web, you need (1) to reduce download size, and next (2) to minimize the total rendering time. You can't expect your site visitors to spend days to see your artwork. We gave realistic use of 3D scene the first priority, while keeping as much rendring quality as possible. Thus, first, the reductionist approach to the 3D Java rendering engine is the technical neccesity. For instance, as the anfy3d.txt file explains, the plugin can "recognize" only the following few elements:

Any objects on scene which can be transformed into a trimesh
Target cameras
Omni lights

In other words, no other objects can be rendered by Anfy 3D engine. ( However, note that there are something which can be exported but cannot be rendered. For instance, camera targets and dummy objects are, although not renderable, exported by the plugin with "unknown node" labeling. This is because, their positions are used to render other objects, although they themselves remain unrenderable.) The plugin works as a filter which only exports what is renderable by Anfy 3D from Max. Thus, you should realize that this plugin does not offer a universal "converter" of MAX files, but provides a neat interface between 3D Studio Max and the Java applet (Anfy 3D) which visualizes the scene. For this reason, an export of normal MAX scenes may often fail, unless, by chance, the fundamental characteristics for the correct functioning of the Anfy3D engine exist. So, if you want to use the plugin with a MAX file, you need to process a whole detailed manual recorrection on it, in order to meet the unique criteria which Anfy 3D applets require to render the scene. I will later discuss the criteria in detail.


The second reductionist approach has not very much to do with the Anfy 3D specifications, but has to do with a modeller's creation style. It"s good to keep in mind that the operations of 3D modelling and animation in MAX follow the same patterns as those of videogame creation; that is to constantly try to reduce at the lowest the number of polygons on any scenes, the number of animation keyframes and so on. In fact, like classic Japanese gardens, tidyness and simplicity are the virtues of minimalists, the 3D modellers!

So, you need two kinds of reductionist approach: (1) Make a scene as simple as possible, but at the same time, as effective as possible, too! (2) Model a scene according to the Anfy3D's specifications. You cannot take full advantage of the Max's all functions, but you can still produce a decent scene while meeting the requirement.

Now, it's time to move on to the Anfy3D specifications through objects to animations sections.

Objects

There are several useful utilities and scripts, though they could be initially integrated componets or external features available for Max, which can be used to optimize your scene for Anfy 3D, that is:

POLYGON COUNTER                  evaluates the polygon number on scene
OPTIMIZE or PROGMESH   reduces the polygon number
COLLAPSE   collapse the stack
DETACHER   subdivides any meshes which have been assigned a multi-sub-object material
COLLECTOR   copies the textures into the directory in which the plugin acts

I wrote earlier that you should always keep the polygon number as small as possible. Polygon counter and Optimize or Progmesh could be useful for this purpose.

Next, note that modifiers are not supported by Anfy 3D. Modifiers are preset rutines that change and transform objects in specific ways. For example, you can use a Twist modifier to achieve an ice cream cone shape easily. You may need one modifier applied to a single object to achieve the effect you want, but in many cases you need more than one modifiers. The list of modifiers applied to the object is called the history or the stack. Usually, you collapse the stack when you need more memory. However, by collapsing the stack, you also remove any animated parameters that may have been a part of any modifiers. Plus, it removes the parametric capabilities of the object too. Yet, here, you don't need to be concerned about that. I reitterate, modifiers are NOT supported under Anfy 3D rendering engine. So, you can collapse the stack of the scene in Max to view the actual animation scene which Anfy 3D renders. If, this results in unexpected animation, or even no animation, you can come back to the scene and edit it again until you get what you want. Be sure that you only assign standard materials to the object, which are the only supported types of materials by Anfy 3D.

Apart from simplyfing polygons, it's good to subdivide a single wide face into several coplanar faces of smaller dimensions by using the utilities of the TESSELLATE type. This is particularly important when you work with a surface which is larger than or equal to the distance between the camera and its target. This prevents any texture derangement but it might enlarge the exported file. So, watch the result! If the number of the faces visible from the target camera exceeds the value of the "Facenum" parameter in the HTML document, you can increase it, but always with moderation. The default value is 2000. You don't need to change this value, unless you're dealing with very large scenes where you see lost polygons.

Materials

The plugin handles only standard materials which are set at the Diffuse color (RGB) and Diffuse Map (bitmap only) parameters. Hence a mesh with a multi-sub-object material has to be subdivided into larger number of groups or linked meshes, and in addition, a standard material has to be assigned to any of them. Next the opacity of materials can be controled by the Opacity parameter. 50 is the liminal value between solid and transparent color modes.

In Max, all mapped materials make use of mapping coordinates, called UVW, to correctly place a bitmap on the object. There are mainly two ways of creating mapping coordinates for an object: (1) Use Generate Mapping Coordinates, when you create an object. (2) Apply the UVW Map modifier to the object. The latter method is more flexible in many respects in that you can not only apply the mapping coordinates, but also scale them, rotate them, etc. I strongly recommend you to use UVW Modifier to generate the mapping coordinates for an object.

As soon as you apply the modifier, the mapping coordinates is created as well as a gizmo (Mapping icon). The gizmo represents the scale, orientation, and position of one copy of the bitmap used in the material. If the gizmo is smaller than the object, the bitmap is tiled across the surface of the object. In this case, you need to set the tiling values according to the UVW, since the tiling values preassigned to the material editor are disposed by the modification, even if you are working on the existing Max project.

You should not use a high resolution map larger than 256 * 256 to avoid tiling for fear tiling error. Because, Anfy 3D rendering engine always uses 256 * 256 pixels maps for internal calcuration. Not to mention that you should not use non-rectangular maps either. That should result in unexpected scene.

Note, if you do not assign a material to an object, Anfy3D will display the object with the color used by default for the wireframe mode in Max.

Any existing image such as the environmental background image is not automatically exported by the plugin. It must be explicitly written at the applet's "Background" parameter. So, do model a scene as you always do, but after the Anfy3D export, remember to edit the HTML to reconstruct the proper scene with necessary parameters filled out by your hand.

If you use just one color as a background, the "Background" value will be of the "rgb000000" type, where the numerical pairs correspond to the RGB hexadecimal values of the chosen color.

As you can see so far, it's easy to understand how it 's normal to have a sort of "ping-pong" procedure between MAX and the HTML document, in order to optimize all the supported parameters.

Lights

Lightning may be the most important aspect of high-quality rendering. It is lightning which decides a sense of depth and realism of a scene. Max supports five different kinds of light source: (1) omni lights, (2) directional lights,  (3)(4) spot lights (both target and free), (5) the global ambient light. However, currently, Anfy 3D only supports omni lights and the global ambient light. An omni light source casts light in all directions and is also known as a point light. Although there are many factors for even omni lightning available in Max, Anfy 3D supports the following three parameters (the rests in Max would not be reflected in the scene by Anfy 3D): multiplier, near strat attenuation and near end attenuation.

(1) MULTIPLIER

Light intensity facor, which decides the power of lightning.

(2) NEAR START ATTENUATION & NEAR END ATTENUATION

Lights can be attenuated by "near start attenuation" and "near end annetuation" parameters in Max. By setting the value for "near start attenuation" and "near end annetuation" above zero, you define the dimension of the visible sphere which includes a smaller invisble sphere within it. In other words, these parameters control where the lights are in effect. Objects are lit up and visible only when they are placed in the range defined by these two values.

Note that as is the case with the rest of the omni lights parameters (Cast Shadows etc.), the USE function is not considered, hence the values from the NEAR START and NEAR END boxes are always valid for the plugin, even though not expressly enabled.

Next, you need to associate a bitmap with the omni light at the "lightmap" parameter in the HTML document.  It's this bitmap image which simulates a light source on a black background. This light source is displayed with the colour appeared on this image, while the light transparentises everything outside of the visible sphere.

Note that if the bitmap of the "lightmap" parameter isn't set up in the HTML, the light will be shown as a white cube, so you had better define your favorite bitmap. In case you don't want to visualize it, it's possible to set the "near start attenuation" parameter at zero.

A useful suggestion is to set up the "near end attenuation" value at the double of the distance between the light source and the furthest face on scene and to set the "Ambient" parameter on the HTML at 0.5, in order to get a "starting" illumination which can be easily modified as you like it.

Let me tell you one technique. You can create a sort of Mask Object, by setting the "near end annetuation" parameter identical to the "near start attenuation" value. The omni light will not give out light; it will just show a kind of "sprite" which you can animate as you want.

In relation to lightning effects, I may mention fog effects as similar kind.

(3) Fog effects.

Then, on the HTML there is the "Fog" parameter which permits to gradually modify the visualization depth of the lit up objects on a scene. This parameter can take three statements separated by a comma ",".

1st statement can be "true" or "false". You always place "true", when you want to activate fog effects.

2nd statement takes the distance between the camera and the starting point of the fog effect.

3rd statement takes the maximum distance between the fog starting point and the finishing point, corresponding to the disappearing of the objects from the scene.

Note that if you set the 3rd statement too small, i.e., the fog effect starts and ends near the camera, you may hide all the objects from the scene. Be careful to set these values.

Don't forget the lightmodel parameter.

(4) Lightmodel

"Lightmodel " defines the requested illumination type or shading algorithms, that is:

"Flat" illumination depending just on the angle of incidence of the light source
"Dist" illumination depending just on the distance from the light source
"Real" illumination depending on both the distance and the angle of incidence of the light source.

Note that lightmodel parameter is ignored in anfy3df applet.

You may rememer that "Real" setting normally provokes a general loss of the light intensity on the scene. So, you need to set appropriate values for the "multiplier" and "near end attenuation" parameters, if you choose this lightmodel.

Now we move on to camera setting.

Cameras

3D Studio Max supports two kinds of cameras, i.e., target and free cameras. A target camera has an eye position and the target which the camera is looking at, while a free camera has no target, otherwise the same as the camera. Basically, you use free camera attached to a motion path when you're making animation sequences. However, Anfy 3D controls only the target cameras.

The FOV (field of vision) of a camera is recognized and can be animated, as well as the camera and the target position. Since the plugin runs the animations ignoring the advanced controllers, many problems can be solved with link operations on the target. For instance, if you link the target to a flying plane, you can simulate the effect of a Look At (see F14.html).

So far the correspondence between the visualization cone in MAX and that of Anfy 3D may not always be identical. So, it is advisable to verify now and then the animation effect with test exportations. In part this is also due to the dimension of the visualization window which we set up with the starting parameter on the HTML document.

One more thing. Anfy 3D supports the parameter called "Far_clip", which is set by default to 2000; all the objects distant more than "Far_clip" are NOT displayed (clipped), so be sure to place an higher value to it if objects you want to see are clipped (or make objects smaller).

A further possibility to intervene the final result is given by the "Filter" parameter on the HTML, whose values can be summarized as follows:

"None"                  no filter
"Antialias"             light blur effect (see Hand.html)
"Blur1"                  medium blur effect (see Hand2.html)
"Blur2"                  heavy blur effect (see Hand3.html)
"Blurmotion1"       "motion" effect on the animation (see Giostra.html)
"Blurmotion2"       "motion" + "colorize" effect, (see Giostra2.html)
"Mixing1"              an additive transparence is applied to the scene.

WARNING: this function normally permits to see a background image but if the background is white, transparency effect changes nothing and only white will be displayed. This is because transparency is an additive effect. (see Tornado.html)

"Mixing2"              a medium transparency is applied to the scene (see Tornado2.html)

Animations

 

Animations allowed are the usual ones which work by keys, that the plugin runs with linear interpolations, completely ignoring TCB, controllers etc.

The following animations are supported:

Animation camera, roll camera, FOV camera
Omni light position
Object positions, rotations, scale (the latter only on the x,y,z axes)

Because of the adopted system, the number of keys used in MAX is not sufficient for Anfy 3D. For instance, consider that at the start of the animation an object is in a certain position and at the end you rotate it by 360degree. A linear interpolation between the two keys will give a null result and in the final animation you will not see any rotation.

To avoid this inconvenience you can follow two methods:

First: to insert during the exporting phase a sample value of the frames. Say, in MAX you have an animation of 100 frames, by setting up 10 as a value, you will get a key every 10 frames, so 10 keys overall; the rotation will be subdivided in steps of 360degrees; each step will be interpolate by Anfy 3D. This method is preferable for simple animations or for a first quick test.

 

 

Second: to use the "ADD KEY" function on the "TRACK VIEW" of MAX, by inserting some additional keys in the point where it is necessary to provide Anfy 3D with more precise data. MAX will automatically calculate the value of the additional keys, hence it is sufficient to click on the inserting point of every key. This method is more precise and flexible, even though a bit more laborious, and what is more, it often permits to reduce the final dimension of the file at minimum.

To export an animation which is not created for the applets use, such as a Character Studio sample or a tutorial of a certain particular function, will often give no result. So, you need to carry out some preparatory operations by substituting the functions or the controller which are not handled by theapplets for "artisan" methods which simulate the required effects and which are compatible with the current limitations (see Jump.html).

Through the course of this document, I tried to summarize the points of the anfy3d.txt, and I think I more or less suceeded in this task. It's now your turn to explore the potentiality of Anfy 3D applets and produce never-seen web animations. Finally, don't forget the two kinds of simplifications. Particularly, the second one, minimize the download size. You want visitors on your site to enjoy your artwork. For this purpose, you need to make animations easier for visitors, and not for your laboratory use!I

Back to Index